All Packages Class Hierarchy This Package Previous Next Index
Interface sun.server.util.Cacheable
- public interface Cacheable
All objects that are required to be cached in the LRUCache
must implement the cache interface.
- See Also:
- LRUCache
-
getContext()
- Retrieve the object that was set in the
setContext method.
-
replaceNotify()
- The notify method is called when an object
is being considered for replacement in the
cache.
-
setContext(Object)
- For efficent performance of the LRUCache, it requires the
Cacheable object to be able set and retrieve an opaque
context object that is used by the LRUCache.
-
size()
- This is the size of this object in
bytes.
size
public abstract int size()
- This is the size of this object in
bytes. When an object is inserted in an LRUCache,
it checks to see if the size can be accomodated. If not
it makes space by throwing out the LRU elements until
space is available. If all else fails, an OutOfMemory exception
is thrown.
setContext
public abstract void setContext(Object o)
- For efficent performance of the LRUCache, it requires the
Cacheable object to be able set and retrieve an opaque
context object that is used by the LRUCache.
- Parameters:
- an - opaque context that is passed in by the cache
- See Also:
- getContext
getContext
public abstract Object getContext()
- Retrieve the object that was set in the
setContext method.
For efficent performance of the LRUCache, it requires the
Cacheable object to be able set and retrieve an opaque
context object that is used by the LRUCache.
- Returns:
- the context object that the cache set in the
setContext method.
- See Also:
- setContext
replaceNotify
public abstract boolean replaceNotify()
- The notify method is called when an object
is being considered for replacement in the
cache. If this method returns false, the object
is NOT replaced in the cache instead the next
replacement candidate is chosen. If this method
returns true, the object is replaced in the cache.
Unilaterally returning false from this object is would
certainly lead to an OutOfMemory exception. Unilaterally
returning true from this method would result in correct
LRU behaviour.
- Returns:
- - true if the object should be replaced, false
if the object should not be replaced.
All Packages Class Hierarchy This Package Previous Next Index